<?php
namespace wechat\controllers;

use Yii;
use yii\base\Event;
use yii\helpers\Url;
use yii\web\Controller;
use framework\helpers\Utils;

/**
 * Site controller
 */
class MoneyrecordController extends Controller
{
	//获取登录用户的资金变动日志
    public function actionMoneylist()
    {
    	$session = yii::$app->session;
    	$session->open();
    	if($session->has('sKey'))	//是否有sKey缓存
    	{
    		if ($_REQUEST)
    		{
    			$page = intval($_REQUEST['page']);
				$page_num = intval($_REQUEST['num']);
    			$sKey = $session->get('sKey');
    			$url = PANDA_SERVER.'/queryUserMoneyList?sKey='.$sKey.'&order=0&curr='.$page.'&num='.$page_num.'&tokenId='.Utils::getTokenId();	//获取用户待收竞标中列表
    			$_result = file_get_contents($url);
    			echo $_result;
    			exit;
    		}
    	}
    	else 
    	{
    		echo '{"msg":"sKey已失效！","status":1001}';
    		exit;
    	}
    }
    
    //获取登录用户的充值记录。
    public function actionRechargelist()
    {
    	$session = yii::$app->session;
    	$session->open();
    	if($session->has('sKey'))	//是否有sKey缓存
    	{
    		if ($_REQUEST)
    		{
    			$page = intval($_REQUEST['page']);
    			$page_num = intval($_REQUEST['num']);
    			$sKey = $session->get('sKey');
    			$url = PANDA_SERVER.'/queryUserRechargeList?sKey='.$sKey.'&order=0&curr='.$page.'&num='.$page_num.'&tokenId='.Utils::getTokenId();	//获取用户待收竞标中列表
    			$_result = file_get_contents($url);
    			echo $_result;exit;
    		}
    	}
    	else
    	{
    		echo '{"msg":"sKey已失效！","status":1001}';
    		exit;
    	}
    }
    
    //获取登录用户的提现记录。
    public function actionWithdrawlist()
    {
    	$session = yii::$app->session;
    	$session->open();
    	if($session->has('sKey'))	//是否有sKey缓存
    	{
    		if ($_REQUEST)
    		{
    			$page = intval($_REQUEST['page']);
    			$page_num = intval($_REQUEST['num']);
    			$sKey = $session->get('sKey');
    			$url = PANDA_SERVER.'/queryUserWithdrawList?sKey='.$sKey.'&order=0&curr='.$page.'&num='.$page_num.'&tokenId='.Utils::getTokenId();	//获取用户待收竞标中列表
    			$_result = file_get_contents($url);
    			echo $_result;exit;
    		}
    	}
    	else
    	{
    		echo '{"msg":"sKey已失效！","status":1001}';
    		exit;
    	}
    }
    
}